﻿using HybridLab.Workflow.Activities.Info;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Lab.Workflow.Activities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HybridLab.Workflow.Activities
{
	[Serializable]
	[Editor(typeof(HybridLabWorkflowDetailsEditor), typeof(UITypeEditor))]
	public class HybridLabWorkflowDetails : IEquatable<HybridLabWorkflowDetails>
	{
		public HybridLabEnvironment HybridLab { get; set; }
        public BuildDetails BuildDetails { get; set; }
		public DeploymentDetails DeploymentDetails { get; set; }
		public RunTestDetails TestParameters { get; set; }

		public HybridLabWorkflowDetails()
        {
			HybridLab = new HybridLabEnvironment();
            DeploymentDetails = new DeploymentDetails();
            BuildDetails = new BuildDetails();
            TestParameters = new RunTestDetails();
        }

		public bool Equals(HybridLabWorkflowDetails other)
		{
			if (object.ReferenceEquals(other, null))
			{
				return false;
			}
			return HybridLab == other.HybridLab && DeploymentDetails == other.DeploymentDetails && BuildDetails == other.BuildDetails && TestParameters == other.TestParameters;
		}

		public override bool Equals(object obj)
		{
			return (((obj != null) && (obj.GetType() == typeof(HybridLabWorkflowDetails))) && this.Equals(obj as HybridLabWorkflowDetails));
		}

		public override int GetHashCode()
		{
			if (HybridLab == null)
			{
				return base.GetHashCode();
			}
			int hashCode = HybridLab.GetHashCode();
			if (DeploymentDetails != null)
			{
				hashCode ^= DeploymentDetails.GetHashCode();
			}
			return hashCode;
		}

		public static bool operator ==(HybridLabWorkflowDetails details1, HybridLabWorkflowDetails details2)
		{
			return details1.Equals(details2);
		}

		public static bool operator !=(HybridLabWorkflowDetails details1, HybridLabWorkflowDetails details2)
		{
			return !(details1 == details2);
		}

		public override string ToString()
		{
			return "Click here to edit details...";
		}
	}
}
